package cn.ustb.dao;

import cn.ustb.entity.ExamArrange;
import org.apache.ibatis.annotations.*;

import java.util.List;

public interface ExamArrangeDao {
    @Select("select * from examarrange")
    List<ExamArrange> getAll();

    @Select("select *from examarrange where studentId = #{studentId}")
    List<ExamArrange> getAllWithStudentId(String studentId);

    @Insert("insert into examarrange values(#{yearTerm},#{studentId},#{studentName},#{examCourse},#{examWay},#{examDate},#{examTime},#{examWeek},#{examCampus},#{examPlace},#{examSeatNum})")
    void insert(ExamArrange examArrange);

    @Update("update examarrange set StudentName = #{studentName},ExamWay = #{examWay}, ExamTime = #{examTime}, ExamWeek = #{examWeek}, ExamCampus = #{examCampus}, Examplace = #{examPlace}, ExamSeatNum = #{examSeatNum} where YearTerm = #{yearTerm} and studentId = #{studentId} and ExamCourse = #{examCourse}")
    void update(ExamArrange examArrange);

    @Delete("delete from examarrange where studentId = #{studentId}")
    void delete(String studentId);

    @Select("select * from examarrange where studentId = #{studentId} and yearTerm = #{yearTerm}")
    List<ExamArrange> getAllWithYearTerm(@Param("studentId") String studentId, @Param("yearTerm") String yearTerm);
}
